home *** CD-ROM | disk | FTP | other *** search
- on exitFrame
- SG(#gPaused, 0)
- set labelName to the frameLabel
- if labelName = 0 then
- put "ERROR: Required Label missing from current frame"
- halt()
- end if
- set pos to offset("-", labelName)
- set lessonNum to value(chars(labelName, 2, pos - 1))
- set lessonPrefix to "L" & string(lessonNum) & "-"
- if not voidp(GG(#gLessonNum)) then
- if GG(#gLessonNum) = lessonNum then
- selectLine(GG(#gActiveScroller), 1, 1)
- return
- end if
- end if
- SG(#gLessonNum, lessonNum)
- SG(#gStepNum, 0)
- SG(#gLessonPrefix, lessonPrefix)
- set the text of member "CurrentLessonSteps#field" to EMPTY
- set autoChannels to GetAutoChannels()
- puppetSprite(getaProp(autoChannels, #lessonRTF), 1)
- puppetSprite(getaProp(autoChannels, #lessonShadowRTF), 1)
- puppetSprite(getaProp(autoChannels, #listTextFIELD), 1)
- puppetSprite(getaProp(autoChannels, #vscrollBITMAP), 1)
- puppetSprite(getaProp(autoChannels, #thumbBITMAP), 1)
- puppetSprite(getaProp(autoChannels, #upScrollBITMAP), 1)
- puppetSprite(getaProp(autoChannels, #downScrollBITMAP), 1)
- set channelNum to getaProp(autoChannels, #lessonRTF)
- puppetSprite(channelNum, 1)
- set the castNum of sprite channelNum to the number of member (lessonPrefix & "Title#richText")
- set channelNum to getaProp(autoChannels, #lessonShadowRTF)
- puppetSprite(channelNum, 1)
- set the castNum of sprite channelNum to the number of member (lessonPrefix & "TitleShadow#richText")
- set stepsText to the text of member (lessonPrefix & "Steps#field")
- set stepsText to stripWhiteSpace(stepsText, #end)
- set the text of member "LineBreakTester#field" to EMPTY
- set lineWrapsList to []
- set lineHeight to the textHeight of member "LineBreakTester#field"
- set linesSoFar to EMPTY
- set memberHeight to 0
- set scrollerData to [:]
- set listCells to []
- set numLines to the number of lines in stepsText
- repeat with lineNum = 1 to numLines
- set thisLine to line lineNum of stepsText
- append(listCells, thisLine)
- if lineNum > 1 then
- set thisLine to RETURN & thisLine
- end if
- set the text of member "LineBreakTester#field" to linesSoFar & thisLine
- set linesSoFar to linesSoFar & thisLine
- set newMemberHeight to the height of member "LineBreakTester#field"
- append(lineWrapsList, (newMemberHeight - memberHeight) / lineHeight)
- set memberHeight to newMemberHeight
- end repeat
- addProp(scrollerData, getaProp(autoChannels, #listTextFIELD), listCells)
- SG(#gLineWrapList, lineWrapsList)
- SG(#gActiveScroller, birth(script "PS_ListScroller", getaProp(autoChannels, #vscrollBITMAP), getaProp(autoChannels, #thumbBITMAP), getaProp(autoChannels, #upScrollBITMAP), getaProp(autoChannels, #downScrollBITMAP), scrollerData))
- selectLine(GG(#gActiveScroller), 1, 1)
- myPreLoad(lessonNum)
- end
-
- on myPreLoad thisLesson
- global gFirstList, gLastList
- cursor(4)
- set previousLesson to thisLesson - 1
- if previousLesson < 0 then
- set previousLesson to 0
- end if
- set previousFirstCast to getaProp(gFirstList, previousLesson)
- set previousLastCast to getaProp(gLastList, previousLesson)
- unloadMember(member previousFirstCast of castLib "VoiceOvers and Sounds", member previousLastCast of castLib "VoiceOvers and Sounds")
- set firstCast to getaProp(gFirstList, thisLesson)
- set lastCast to getaProp(gLastList, thisLesson)
- preloadMember(member firstCast of castLib "VoiceOvers and Sounds", member lastCast of castLib "VoiceOvers and Sounds")
- cursor(0)
- end
-